package com.yegs.jindie.serviceImpl;

import com.yegs.jindie.entity.LoggerVo;
import com.yegs.jindie.entity.PageTO;
import com.yegs.jindie.repository.LoggerRepository;
import com.yegs.jindie.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class LogServiceImpl implements LogService {

    private static final String STATUS_BEGIN = "开始执行!";
    private static final String STATUS_END = "执行完成!";

    @Autowired
    private LoggerRepository loggerRepository;


    public List<LoggerVo> findAll() {
        return loggerRepository.findAll();
    }

    @Override
    public void saveBeginLog(String jobname,String message) {
        LoggerVo log = new LoggerVo(STATUS_BEGIN, jobname, message);
        loggerRepository.save(log);
    }
    @Override
    public void saveEndLog(String jobname,String message) {
        LoggerVo log = new LoggerVo(STATUS_END, jobname, message);
        loggerRepository.save(log);
    }


}
